package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入订单详情
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 动态查询
     * @param orderDetail
     * @return
     */
    List<OrderDetail> list(OrderDetail orderDetail);

    /**
     * 根据 orderid 查询订单详情
     * @param orderId
     * @return
     */
    @Select("select id, name, image, order_id, dish_id, setmeal_id, dish_flavor, number, amount" +
            " from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    /**
     * 查询order_details
     * @param map
     * @return
     */
    List<GoodsSalesDTO> getByMap(Map map);
}
